from src.utils.time_tool import get_china_time

from src.init.init_db import db
from src.utils.model import BaseModel


class CommentModel(BaseModel):
    __tablename__ = 'comment'  # 评论表

    cid = db.Column(db.BigInteger, primary_key=True)  # 评论id
    aid = db.Column(db.BigInteger, db.ForeignKey('article.aid'))  # 评论对应的文章
    content = db.Column(db.Text, nullable=False)  # 评论内容
    fcid = db.Column(db.BigInteger, db.ForeignKey('comment.cid'), nullable=True)  # 父评论id
    uid = db.Column(db.BigInteger, db.ForeignKey('user.uid'), nullable=False)  # 评论者id
    createtime = db.Column(db.DateTime, default=get_china_time())  # 创建时间
